function [tr_data, tr_labels, te_data, te_labels] = ...
         gen_splitted_data(X1train, X2train, ytrain, ...
                           gidtrain, test_group_id, norm_type)
%generate_data Preprocesses the data and creates training and test data. 
%              The split is done according to test_group_id - this is the
%              group that will be used for testing.
    diff = gen_data(X1train, X2train, norm_type);
    
    % split to test and training
    tr_data = diff(gidtrain~=test_group_id,:);
    te_data = diff(gidtrain==test_group_id,:);
    tr_labels = ytrain(gidtrain~=test_group_id);
    te_labels = ytrain(gidtrain==test_group_id);
end


